package org.example.myleet.p470;

import java.util.HashMap;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        Solution solution = new Solution();
        Map<Integer, Integer> map = new HashMap<>();
        int total = 10000;
        for (int i = 0; i < total; ++i) {
            int rand = solution.rand7();
            int count = map.getOrDefault(rand, 0);
            ++count;
            map.put(rand, count);
        }
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey() + ": " + entry.getValue() / (double) total);
        }
        System.out.println("=====================");
        map.clear();
        for (int i = 0; i < total; ++i) {
            int rand = solution.rand10();
            int count = map.getOrDefault(rand, 0);
            ++count;
            map.put(rand, count);
        }
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey() + ": " + entry.getValue() / (double) total);
        }
    }
}
